Skip to main content

reshape

reshape(input: any[] | Mat | Tensor, sizes: any[]) : any[] | Mat | Tensor

param input a JS array, matrix or tensor, the construct to reshape

param sizes a 1-d array representing the size - the size is the defining feature of how to reshape

returns - any[] | Mat | Tensor - a JS array, matrix or tensor reshaped with the corresponding size given in sizes

size should be like [2, 2, 2] or [2, -1]. Here, -1 means automatically matching.